## 条件

# Has 类
Has-Cmd(){ [ ! -z "$(command -v $1)" ];} # 简单判断命令存在
Has-File(){ [ -f "$1" ];} # 简单判断文件存在
Has-Dir(){ [ -d "$1" ];} # 简单判断目录存在
Has-Pkg(){ [ ! -z "$(dpkg -s $1 2>/dev/null)" ];} # 使用 dpkg 判断软件存在
Has-Stdin(){ [ ! -t 0 ];} # 简单判断标准输入
Has-Stdout(){ [ ! -t 1 ];} # 简单判断标准输出

# Is 类
Is-Num(){ [[ "$1" =~ ^[0-9]+$ ]];} # 简单判断是否纯数字

# In 类
In-Value(){ if [ -z "$2" ];then "${!1}" 2>/dev/null;elif [[ "$2" == '==' ]];then [[ "${!1}" == "${!3}" ]];fi;} # 变量引用